refactor: use pandas Timestamp and Timedelta#216
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #216 +/- ##
==========================================
+ Coverage 93.31% 94.37% +1.06%
==========================================
Files 33 45 +12
Lines 1615 1707 +92
==========================================
+ Hits 1507 1611 +104
+ Misses 108 96 -12 ☔ View full report in Codecov by Sentry. |
12ec12e to
37e7b48
Compare
There was a problem hiding this comment.
Pull request overview
This pull request refactors AIMBAT to use pandas Timestamp and Timedelta types instead of Python's built-in datetime and timedelta. This change improves nanosecond precision handling and provides better integration with pandas-based data processing.
Changes:
- Added pandas and pandas-stubs dependencies (version 3.0.1+)
- Implemented custom SQLAlchemy type decorators for pandas Timestamp/Timedelta
- Refactored all datetime/timedelta types across models, core modules, and CLI
- Reorganized code structure (created aimbat_types, utils, core modules)
- Updated configuration system to use log_level instead of debug flag
Reviewed changes
Copilot reviewed 67 out of 71 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock, pyproject.toml | Added pandas>=3.0.1 and pandas-stubs>=3.0.0.260204 dependencies |
| src/aimbat/models/_sqlalchemy.py | New SQLAlchemy type decorators for Timestamp/Timedelta with UTC handling |
| src/aimbat/aimbat_types/_pydantic.py | Pydantic validators for pandas types with positive/negative constraints |
| src/aimbat/models/_models.py | Updated all datetime fields to use PydanticTimestamp, timedelta to PydanticTimedelta |
| src/aimbat/_lib/validators.py | Validators for positive/negative Timedelta values |
| src/aimbat/_config.py | Changed debug bool to log_level Literal, updated Timedelta fields |
| src/aimbat/utils/* | Reorganized utility functions, added timestamp_formatter |
| src/aimbat/core/* | Updated all core modules to use Timestamp/Timedelta types |
| src/aimbat/cli/* | Updated CLI to handle Timedelta parameters |
| tests/* | Updated test fixtures and assertions for timestamp comparisons |
Comments suppressed due to low confidence (3)
src/aimbat/core/_event.py:114
- This commented-out function definition should be removed. The function
get_active_eventhas been moved toutils._active_eventand is imported in the__all__list above. Keeping commented-out code decreases maintainability.
src/aimbat/utils/_sampledata.py:9 - Typo in
__all__definition: it should be__all__(two underscores) not__all_(one underscore). This means the exports won't work correctly.
src/aimbat/core/_project.py:19 - Typo in
__all__definition: it should be__all__(two underscores) not___all__(three underscores). This means the exports won't work correctly.
dd7f6cb to
7f2b153
Compare
7f2b153 to
5dc0263
Compare
📚 Documentation preview 📚: https://aimbat--216.org.readthedocs.build/en/216/